<script setup lang="ts">

</script>

<template>
  <template>
    <div>
      <button @click="send">发送get</button>
      <br />
      {{info}}
    </div>
  </template>

  <script>
    import axios from "axios";

    export default {
      data() {
        return {
          info: null
        };
      },
      methods: {
        send() {
          axios.get('https://www.runoob.com/try/ajax/json_demo.json')
              .then(response => (this.info = response))
              .catch(function(error) {
                // 请求失败处理
                console.log(error);
              });
        }
      }
    };
  </script>

</template>

<style scoped>

</style>